#!/bin/bash
script_dir=$(cd "$(dirname "$0")"; pwd)
build_dir=$script_dir/deploy

build_type=$1
if [ -z "$build_type" ]; then
    build_type="Release"
fi

if [ -z "${ACIS_ROOT}"] ; then 
    export ACIS_ROOT=/home/jason/tools/acis
fi

if [ -z "${INTEROP_ROOT}"] ; then 
    export INTEROP_ROOT=/home/jason/tools/interOp
fi

if [ -z "${INTEROP_LIBRARY_ZIP_DIR}"] ; then 
    export INTEROP_LIBRARY_ZIP_DIR=/home/jason/tools/interOp/3rd
fi 

if [ -z "${AMCAX_PATH}"] ; then 
    export AMCAX_PATH=/home/jason/tools/amcax
fi

export LD_LIBRARY_PATH=${ACIS_ROOT}/linux_a64/code/bin:${INTEROP_ROOT}/linux_a64/code/bin:${env:LD_LIBRARY_PATH}

echo  $INTEROP_LIBRARY_ZIP_DIR
rm -rf ${build_dir}
bash setup.sh $build_type

cmake -DCMAKE_BUILD_TYPE:STRING=$build_type  -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE  --no-warn-unused-cli -S$script_dir -B$build_dir

cmake  --build $build_dir --config $build_dir  -j20 
cmake  --install $build_dir  --strip --config $build_dir
